<template>
  <div class="app-container">
    <el-dialog title="岗位详情" :visible.sync="videoVisible" width="90%" :close-on-click-modal='false'
               append-to-body>
      <el-descriptions class="margin-top" :column="4" size="medium" border>
        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              岗位名称
            </center>
          </template>
          <center>
            {{ ItoStation.stationName }}
          </center>
        </el-descriptions-item>

       <!-- <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              企业名称
            </center>
          </template>
          <center>
            {{ ItoStation.companyName }}
          </center>
        </el-descriptions-item>-->

        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              岗位类别
            </center>
          </template>
          <center>
            {{ ItoStation.stationCategory }}
          </center>
        </el-descriptions-item>
        <el-descriptions-item v-if="ItoStation.stationCategory == 'RPO岗位'">
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              RPO岗位定价(K)
            </center>
          </template>
          <center>
            {{ ItoStation.postPricing }}K
          </center>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              负责商务
            </center>
          </template>
          <center>{{ ItoStation.createdBy }}</center>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              发布日期
            </center>
          </template>
          <center>{{ parseTime(ItoStation.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</center>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              学历要求
            </center>
          </template>
          <center>{{ ItoStation.education }}</center>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              岗位等级
            </center>
          </template>
          <center>
            {{ ItoStation.jobGrade }}

          </center>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              用工时长(月)
            </center>
          </template>
          <center>{{ ItoStation.endTime }}</center>
        </el-descriptions-item>

        <!--        <span v-if="interview==true">-->
        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              工资薪酬(K)
            </center>
          </template>
          <center v-if="ItoStation.interview == 0 ">{{ ItoStation.startMoney }}~{{
              ItoStation.endMoney
            }}K
          </center>
          <center v-if="ItoStation.interview == 1 ">面议</center>

        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              招聘人数
            </center>
          </template>
          <center>{{ ItoStation.need }}</center>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center><i class="el-icon-user"></i>
              招聘截止日期
            </center>
          </template>
          <center>{{ parseTime(ItoStation.wokeEndTime, '{y}-{m}-{d}') }}</center>
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              省市区
            </center>
          </template>
          <center>
            {{ ItoStation.province }}
          </center>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <center>
              <i class="el-icon-user"></i>
              详细地址
            </center>
          </template>
          <center>
            {{ ItoStation.wokeAddress }}
          </center>
        </el-descriptions-item>


      </el-descriptions>
      <el-descriptions class="margin-top" size="medium" direction="vertical" :column="2" border>

        <el-descriptions-item :span="4">
          <template slot="label">
            <i class="el-icon-user"></i>
            岗位职责
          </template>
          <span v-html="ItoStation.jobDescription"></span>
        </el-descriptions-item>


        <el-descriptions-item :span="4">
          <template slot="label">
            <i class="el-icon-user"></i>
            岗位要求
          </template>
          <span v-html="ItoStation.remarks"></span>
        </el-descriptions-item>
      </el-descriptions>
      <br>
      <span style="padding-left: 20px;font-size: 20px;color:#673ab7;">投递记录</span>&nbsp;&nbsp;
      <el-radio-group v-model="radio1">
        <el-radio-button label="全部" @click.native="aaa('200')"></el-radio-button>
        <el-radio-button label="待初筛" @click.native="aaa(0)"></el-radio-button>
        <el-radio-button label="待面试" @click.native="aaa(1)"></el-radio-button>
        <el-radio-button label="待录用" @click.native="aaa(2)"></el-radio-button>
        <el-radio-button label="待入职" @click.native="aaa(3)"></el-radio-button>
        <el-radio-button label="已入职" @click.native="aaa(6)"></el-radio-button>
      </el-radio-group>
      <el-button type="primary" style="float: right;margin-right: 20px;" @click="downloadAll">批量下载</el-button>
      <br>
      <hr>
      <el-table :data="auitvoList"
                ref="multipleTable"
                tooltip-effect="dark"
                style="width: 100%"
                @selection-change="getIds">
        <el-table-column

          align="center"
          type="selection"
          width="55">
        </el-table-column>
        <el-table-column label="状态" align="center" prop="isFirst">
          <template slot-scope="scope">

                        <span v-if="scope.row.isFirst == 0">
                          <el-tag type="info">待初筛</el-tag>
                        </span>
            <span v-if="scope.row.isFirst == 1">
                           <el-tag type="primary">待面试</el-tag>
                        </span>
            <span v-if="scope.row.isFirst == 2">
                           <el-tag type="warning">待录用</el-tag>
                        </span>
            <span v-if="scope.row.isFirst == 3">
                           <el-tag type="warning">待入职</el-tag>
                        </span>
            <span v-if="scope.row.isFirst == 6">
                           <el-tag type="danger">已入职</el-tag>
                        </span>
          </template>

        </el-table-column>
        <el-table-column label="创建时间" align="center" prop="createTime" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="负责人" align="center" prop="createName"/>
        <el-table-column label="简历名称" align="center" prop="resumeName"/>
        <el-table-column label="简历电话" align="center" prop="phone"/>
        <el-table-column label="岗位名称" align="center" prop="stationName"/>
        <el-table-column label="岗位电话" align="center" prop="companyPhone"/>
        <el-table-column label="岗位邮箱" align="center" prop="companyMailbox"/>
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              @click="download(scope.row.resumeId)"
              v-hasPermi="['system:station:edit']"
            >下载简历
            </el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <div class="monitorTop">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="商务分配" name="first">
          <el-row :gutter="10">
            <el-col :xs="4">
              <el-form :inline="true" :model="stationQuery" class="demo-form-inline">
                <el-form-item>
                  <el-input v-model="stationQuery.stationUserName" placeholder="商务人员名称"></el-input>
                </el-form-item>
                <input type="text" style="display: none;">
                <el-form-item>
                  <el-button type="primary" @click="getStationUserList">查询</el-button>
                  <el-button type="warning" @click="stationReset">重置</el-button>
                </el-form-item>
              </el-form>
            </el-col>
          </el-row>
          <el-row>
            <el-col :xs="4">
              <el-table v-loading="stationLoading" :header-cell-style="{'text-align':'center'}" :data="stationUserList" style="width: 100%">
                <el-table-column
                  type="index"
                  align="center"
                  label="序号" width="100">
                </el-table-column>
                <el-table-column
                  prop="stationUserName"
                  align="center"
                  label="商务人员名称">
                </el-table-column>
                <el-table-column
                  align="center"
                  prop="countStation"
                  label="在招岗位">
                  <template slot-scope="scope">
                    <span v-if="scope.row.countStation === null">
                      0
                    </span>
                    <span v-if="scope.row.countStation !== null">
                      {{ scope.row.countStation }}
                    </span>
                  </template>
                </el-table-column>
                <el-table-column
                  align="center"
                  prop="isAllocation"
                  label="状态">
                  <template slot-scope="scope">
                    <span v-if="scope.row.isAllocation === null">
                      未分配
                    </span>
                    <span v-if="scope.row.isAllocation !== null">
                      已分配
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="操作">
                  <template slot-scope="scope">
                    <el-button type="text" @click="getStationByUserId(scope.row)">查看岗位</el-button>
                    <el-button type="text" @click="getAllocationResume(scope.row)">分配招聘</el-button>
                    <el-button type="text" @click="checkAbutting(scope.row)">查看对接招聘</el-button>
                  </template>
                </el-table-column>
              </el-table>
              <pagination v-show="stationDeliveryTotal>0" :total="stationDeliveryTotal"
                          :page.sync="stationQuery.pageNum"
                          :limit.sync="stationQuery.pageSize"
                          @pagination="getStationUserList"/>
            </el-col>
          </el-row>
          <el-dialog title="对接招聘" :visible.sync="checkResumeVisible">
            <el-table :data="checkResumeList">
              <el-table-column align="center" type="index" label="序号" width="150"></el-table-column>
              <el-table-column align="center" property="nickName" label="招聘人员名称" width="200"></el-table-column>
              <el-table-column align="center" property="createTime" label="分配时间">
                <template slot-scope="scope">
                  <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="操作">
                <template slot-scope="scope">
                  <el-button type="text" @click="deleteCheckResume(scope.row)">解除</el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-dialog>
          <el-drawer
            title="查看岗位"
            :visible.sync="stationDrawer"
            size="70%"
            direction="rtl"
            :before-close="stationDrawerClose">
            <el-table :data="stationList">
              <el-table-column
                type="index"
                align="center"
                height="400"
                label="序号" width="100">
              </el-table-column>
              <el-table-column align="center" prop="stationName" label="岗位名称" width="150"></el-table-column>
              <el-table-column align="center" prop="jobGrade" label="岗位等级" width="100"></el-table-column>
              <!--<el-table-column align="center" prop="companyName" label="企业名称" width="200"></el-table-column>-->
              <el-table-column label="薪资范围" align="center" prop="startMoney" >
                <template slot-scope="scope">
                  {{scope.row.startMoney +'~' + scope.row.endMoney}} K
                </template>
              </el-table-column>
              <el-table-column align="center" prop="createdBy" label="负责商务" width="150"></el-table-column>
              <el-table-column align="center" prop="need" label="招聘人数" width="80"></el-table-column>
              <el-table-column align="center" prop="createTime" width="200" label="创建时间">
                <template slot-scope="scope">
                  <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" prop="wokeEndTime" label="招聘截至" width="200">
                <template slot-scope="scope">
                  <span>{{ parseTime(scope.row.wokeEndTime, '{y}-{m}-{d}') }}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" prop="jobGrade" label="待初筛" width="60">
                <template slot-scope="scope">
                  <span v-if="scope.row.cou0 == null">0</span>
                  <span v-if="scope.row.cou0 != null">{{ scope.row.cou0 }}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" prop="jobGrade" label="待面试" width="60">
                <template slot-scope="scope">
                  <span v-if="scope.row.cou1 == null">0</span>
                  <span v-if="scope.row.cou1 != null">{{ scope.row.cou1 }}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" prop="jobGrade" label="待入职" width="60">
                <template slot-scope="scope">
                  <span v-if="scope.row.cou2 == null">0</span>
                  <span v-if="scope.row.cou2 != null">{{ scope.row.cou2 }}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="待录用" width="60" prop="cou2">
                <template slot-scope="scope">
                  <span v-if="scope.row.cou3 == null">0</span>
                  <span v-if="scope.row.cou3 != null">{{ scope.row.cou3 }}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" prop="jobGrade" label="已入职" width="60">
                <template slot-scope="scope">
                  <span v-if="scope.row.cou6 == null">0</span>
                  <span v-if="scope.row.cou6 != null">{{ scope.row.cou6 }}</span>
                </template>
              </el-table-column>
              <el-table-column label="操作" width="200" align="center" class-name="small-padding fixed-width"
                               fixed="right">
                <template slot-scope="scope">
                  <el-button
                    size="mini"
                    type="text"
                    icon="el-icon-share"
                    @click="playVideo(scope.row.stationId)"
                    v-hasPermi="['system:station:query']"
                  >岗位详情
                  </el-button>
                </template>
              </el-table-column>
            </el-table>

          </el-drawer>

          <el-dialog title="分配招聘人员" :before-close="resumeUserClose" :visible.sync="resumeUserVisible">
            <el-row :gutter="20" style="margin-left: 30px">
              <el-col :span="10" :xs="24">
                <el-form :inline="true" :model="resumeUserParams">
                  <el-form-item>
                    <el-input v-model="resumeUserParams.all">
                      <el-button slot="append" @click="getResumeUserList" icon="el-icon-search"></el-button>
                    </el-input>
                  </el-form-item>
                  <input type="text" class="form-control" style="display:none">
                </el-form>
                <el-table ref="staffTable"
                          border
                          fit
                          height="500"
                          highlight-current-row
                          @selection-change="userIdsChange" :data="resumeUserList">
                  <el-table-column type="selection" width="50" align="center"/>
                  <el-table-column align="center" property="nickName" label="招聘人员名称"></el-table-column>
                  <el-table-column align="center" property="deptName" label="所属部门"></el-table-column>
                </el-table>
              </el-col>
              <el-col :span="2" :xs="24">
                <el-button
                  @click="addStaff"
                  type="primary"
                  :disabled="!staffData.length"
                  icon="el-icon-arrow-right"
                  circle
                ></el-button>
                <el-button
                  @click="removeStaff"
                  type="primary"
                  :disabled="!selectedStaffData.length"
                  icon="el-icon-arrow-left"
                  circle
                  style="margin-left: 0;margin-top: 10px;"
                ></el-button>
              </el-col>
              <el-col :span="10">
                <div style="margin-top: 25px">
                  <h3>已选（{{ names.length + '人' }}）</h3>
                </div>
                <el-table
                  ref="selectedStaffTable"
                  :data="names"
                  border
                  height="450"
                  fit
                  highlight-current-row
                  @selection-change="handleSelectedStaffChange"
                >
                  <el-table-column type="selection" width="55"></el-table-column>
                  <el-table-column align="center" property="nickName" label="招聘人员名称"></el-table-column>
                  <el-table-column align="center" property="deptName" label="所属部门"></el-table-column>
                </el-table>
                <div style="float: right;margin-top: 15px;margin-right: 20px">
                  <el-button @click="resumeUserClose">取 消</el-button>
                  <el-button type="primary" @click="changeInfo">确 定</el-button>
                </div>
              </el-col>
            </el-row>
          </el-dialog>
        </el-tab-pane>
        <el-tab-pane label="招聘" name="second">
          <el-row :gutter="10">
            <el-col :xs="4">
              <el-form :inline="true" :model="resumeQuery" class="demo-form-inline">
                <el-form-item>
                  <el-input v-model="resumeQuery.resumeUserName" placeholder="招聘人员名称"></el-input>
                </el-form-item>
                <input type="text" style="display: none;">
                <el-form-item>
                  <el-button type="primary" @click="getResumeList">查询</el-button>
                  <el-button type="warning" @click="resumeReset">重置</el-button>
                </el-form-item>
              </el-form>
            </el-col>
          </el-row>
          <el-row>
            <el-col :xs="4">
              <el-table v-loading="resumeLoading" :header-cell-style="{'text-align':'center'}" :data="resumeCountList" style="width: 100%">
                <el-table-column
                  align="center"
                  type="index"
                  label="序号" width="100">
                </el-table-column>
                <el-table-column prop="resumeUserName" align="center" label="招聘人员名称"></el-table-column>
                <el-table-column prop="countResume" align="center" label="在招岗位"></el-table-column>
                <el-table-column prop="cou0" align="center" label="待初筛">
                  <template slot-scope="scope">
                    <span v-if="scope.row.cou0 == null">0</span>
                    <span v-if="scope.row.cou0 != null">{{scope.row.cou0}}</span>
                  </template>
                </el-table-column>
                <el-table-column prop="cou1" align="center" label="待面试">
                  <template slot-scope="scope">
                    <span v-if="scope.row.cou1 == null">0</span>
                    <span v-if="scope.row.cou1 != null">{{scope.row.cou1}}</span>
                  </template>
                </el-table-column>
                <el-table-column prop="cou2" align="center" label="待录用">
                  <template slot-scope="scope">
                    <span v-if="scope.row.cou2 == null">0</span>
                    <span v-if="scope.row.cou2 != null">{{scope.row.cou2}}</span>
                  </template>
                </el-table-column>
                <el-table-column prop="cou3" align="center" label="待入职">
                  <template slot-scope="scope">
                    <span v-if="scope.row.cou3 == null">0</span>
                    <span v-if="scope.row.cou3 != null">{{scope.row.cou3}}</span>
                  </template>
                </el-table-column>
                <el-table-column prop="cou6" align="center" label="已入职">
                  <template slot-scope="scope">
                    <span v-if="scope.row.cou6 == null">0</span>
                    <span v-if="scope.row.cou6 != null">{{scope.row.cou6}}</span>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="操作">
                  <template slot-scope="scope">
                    <el-button type="text" @click="checkStation(scope.row.userId)">查看岗位</el-button>
                    <el-button type="text" @click="principalUser(scope.row.userId)">负责商务</el-button>
                  </template>
                </el-table-column>
              </el-table>
              <pagination v-show="resumeDeliveryTotal>0" :total="resumeDeliveryTotal"
                          :page.sync="resumeQuery.pageNum"
                          :limit.sync="resumeQuery.pageSize"
                          @pagination="getResumeList"/>
            </el-col>
          </el-row>
          <el-dialog title="对接招聘" :visible.sync="principalUserVisible">
            <el-table :data="principalUserList">
              <el-table-column align="center" type="index" label="序号" width="150"></el-table-column>
              <el-table-column align="center" property="nickName" label="招聘人员名称" width="200"></el-table-column>
              <el-table-column align="center" property="createTime" label="分配时间">
                <template slot-scope="scope">
                  <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="操作">
                <template slot-scope="scope">
                  <el-button type="text" @click="deletePrincipalUser(scope.row)">解除</el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-dialog>
            <el-drawer
              title="查看岗位"
              :visible.sync="checkStationVisible"
              size="80%"
              direction="rtl">
            <!--    显示页面-->
            <el-table :data="stationCountList"
                      style="width: 100%" max-height="100%">
              <el-table-column type="index" label="序号" align="center" width="50"/>
              <el-table-column label="岗位名称" align="center" prop="stationName" width="150"/>
              <el-table-column label="岗位等级" align="center" prop="jobGrade" width="100"/>
             <!-- <el-table-column label="企业名称" align="center" prop="companyName" width="200"/>-->
              <el-table-column label="负责商务" align="center" prop="createdBy" width="100"/>
              <el-table-column label="招聘人数" align="center" prop="need" width="100"/>
              <el-table-column label="招聘截止" align="center" prop="wokeEndTime" width="100">
                <template slot-scope="scope">
                  <span>{{ parseTime(scope.row.wokeEndTime, '{y}-{m}-{d}') }}</span>
                </template>
              </el-table-column>
              <el-table-column label="待初筛" align="center" width="60" prop="cou0">
                <template slot-scope="scope">
          <span v-if="scope.row.cou0 == null">
           0
          </span>
                  <span v-if="scope.row.cou0 != null">
           {{ scope.row.cou0 }}
          </span>
                </template>


              </el-table-column>
              <el-table-column label="待面试" align="center" width="60" prop="cou1">
                <template slot-scope="scope">
          <span v-if="scope.row.cou1 == null">
           0
          </span>
                  <span v-if="scope.row.cou1 != null">
           {{ scope.row.cou1 }}
          </span>
                </template>

              </el-table-column>
              <el-table-column label="待入职" align="center" width="60" prop="cou2">
                <template slot-scope="scope">
          <span v-if="scope.row.cou2 == null">
           0
          </span>
                  <span v-if="scope.row.cou2 != null">
           {{ scope.row.cou2 }}
          </span>
                </template>
              </el-table-column>
              <el-table-column label="待录用" align="center" width="60" prop="cou2">
                <template slot-scope="scope">
          <span v-if="scope.row.cou3 == null">
           0
          </span>
                  <span v-if="scope.row.cou3 != null">
           {{ scope.row.cou3 }}
          </span>
                </template>
              </el-table-column>
              <el-table-column label="已入职" align="center" width="60" prop="cou3">
                <template slot-scope="scope">
          <span v-if="scope.row.cou6 == null">
           0
          </span>
                  <span v-if="scope.row.cou6 != null">
           {{ scope.row.cou6 }}
          </span>
                </template>
              </el-table-column>
              <el-table-column label="岗位创建时间" align="center" prop="createTime" width="180">
                <template slot-scope="scope">
                  <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
                </template>
              </el-table-column>
              <el-table-column label="操作" width="100" align="center" class-name="small-padding fixed-width" fixed="right">
                <template slot-scope="scope">
                  <el-button
                    size="mini"
                    type="text"
                    icon="el-icon-share"
                    @click="playVideo(scope.row.stationId)"
                    v-hasPermi="['system:station:query']"
                  >岗位详情
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
            </el-drawer>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<script>
  import {
    getStation,
    getStationResume
  } from "@/api/system/station";
  import {
    getStationUserList,
    getStationByUserId,
    getResumeUserList,
    addResumeUsers,
    getNamesByStationUserId,
    checkAbutting,
    deleteCheckResume,
    getResumeList,
    checkStation,
    principalUser
  } from '@/api/system/delivery'
  import Template from "@/views/system/email/ItoTemplate";

  export default {
    name: "stationDelivery",
    components: {Template},
    data() {
      return {
        activeName: 'first',
        stationUserList: [],
        resumeCountList: [],
        stationCountList:[],
        principalUserList:[],
        stationQuery: {
          stationUserName: '',
          pageNum: 1,
          pageSize: 10
        },
        stationLoading:false,
        resumeLoading:false,
        stationDeliveryTotal: 0,
        resumeDeliveryTotal: 0,
        resumeQuery: {
          resumeUserName: '',
          pageNum: 1,
          pageSize: 10
        },
        stationList: [],
        stationDrawer: false,
        ItoStation: {},
        videoVisible: false,
        resumeUserVisible: false,
        checkStationVisible:false,
        principalUserVisible:false,
        resIds: [],
        auitvoList: [],
        radio1: '',
        sId: 0,
        queryParamsAuitvo: {
          pageNum: 1,
          pageSize: 10,
        },
        resumeUserList: [],
        userList: [],
        names: [],
        selectedStaffData: [],
        staffData: [],
        resumeUserParams: {},
        stationUserId: 0,
        checkResumeVisible: false,
        checkResumeList: []
      }
    },
    created() {
      this.getStationUserList()
      this.getResumeList()
    },
    methods: {
      getResumeList() {
        this.resumeLoading = true
        getResumeList(this.resumeQuery).then(res => {
          this.resumeCountList = res.rows
          this.resumeDeliveryTotal = res.total
        })
        this.resumeLoading = false
      },
      resumeReset() {
        this.resumeQuery = {
          pageNum : 1,
          pageSize: 10
        }
        this.getResumeList()
      },
      checkStation(userId){
        checkStation(userId).then(res =>{
          this.stationCountList = res.rows
          this.checkStationVisible = true
        })
      },
      principalUser(userId){
        principalUser(userId).then(res =>{
          this.principalUserList = res.data
          this.principalUserVisible = true;
        })
      },
      deletePrincipalUser(row){
        this.$confirm('是否确认解除与该商务人员的对接?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          deleteCheckResume(row.userId).then(res =>{
            principalUser(res.data.resumeUserId).then(res =>{
              this.principalUserList = res.data
              this.getResumeList()
              this.principalUserVisible = true;
            })

            this.$message({
              type: 'success',
              message: '已解除与' + row.nickName + '的关联!'
            });
          })
        })

      },
      getResumeUserList() {
        getResumeUserList(this.resumeUserParams).then(res => {
          this.resumeUserList = res.rows
        })
      },
      resumeUserClose() {
        this.resumeUserVisible = false
        this.resumeUserParams = {}
        this.names = []
      },
      changeInfo() {
        addResumeUsers(this.stationUserId, this.names).then(res => {
          this.getStationUserList()
          this.resumeUserVisible = false
          this.names = []
        })
      },
      // 将右边表格选择项存入selectedStaffData中
      handleSelectedStaffChange(rows) {
        this.selectedStaffData = [];
        if (rows) {
          rows.forEach(row => {
            if (row) {
              this.selectedStaffData.push(row);
            }
          });
        }
      }
      ,
      addStaff() {
        setTimeout(() => {
          this.$refs["staffTable"].clearSelection();
          this.$refs["selectedStaffTable"].clearSelection();
        }, 0);
        let repeat = false;
        this.names.forEach(item => {
          if (this.staffData[0] && item.userId === this.staffData[0].userId) {
            repeat = true;
            alert("此员工已添加");
            return;
          }
        });
        if (repeat === false) {
          this.staffData.forEach(item => {
            this.names.push(item);
          });
          for (let i = 0; i < this.userList.length; i++) {
            for (let j = 0; j < this.staffData.length; j++) {
              if (
                this.userList[i] &&
                this.staffData[j] &&
                this.userList[i].userId === this.staffData[j].userId
              ) {
                this.userList.splice(i, 1);
              }
            }
          }
        }
      }
      ,
      removeStaff() {
        setTimeout(() => {
          this.$refs["staffTable"].clearSelection();
          this.$refs["selectedStaffTable"].clearSelection();
        }, 0);
        this.selectedStaffData.forEach(item => {
          this.userList.push(item);
        });
        for (let i = 0; i < this.names.length; i++) {
          for (let j = 0; j < this.selectedStaffData.length; j++) {
            if (
              this.names[i] &&
              this.selectedStaffData[j] &&
              this.names[i].userId === this.selectedStaffData[j].userId
            ) {
              this.names.splice(i, 1);
            }
          }
        }
      },
      userIdsChange(val) {
        this.staffData = [];
        if (val) {
          val.forEach(row => {
            if (row) {
              this.staffData.push(row);
            }
          });
        }
      }
      ,
      getStationUserList() {
        this.stationLoading = true
        getStationUserList(this.stationQuery).then(res => {
          this.stationLoading = false
          this.stationDeliveryTotal = res.total
          this.stationUserList = res.rows

        })
      },
      stationReset() {
        this.stationQuery = {
          stationUserName: '',
          pageNum: 1,
          pageSize: 10
        }
        this.getStationUserList()
      },
      getStationByUserId(row) {
        getStationByUserId(row.userId).then(res => {
          this.stationList = res.rows
          this.stationDrawer = true
        })
      },
      stationDrawerClose() {
        this.stationDrawer = false
      },
      playVideo(stationId) {
        var isFirst = '200';
        this.radio1 = '全部'
        this.sId = stationId;
        this.queryParamsAuitvo.stationId = stationId;
        this.queryParamsAuitvo.isFirst = isFirst
        //触发点击时,让其显示
        getStationResume(this.queryParamsAuitvo).then(response => {
          this.auitvoList = response.rows;
          // this.videoVisibleResumeStation = true
        });
        getStation(stationId).then(response => {
          this.ItoStation = response.data;
          this.videoVisible = true
        });
      },
      aaa(xxx) {
        /*var stationId = this.sId;
        this.isFirst = xxx;*/
        this.queryParamsAuitvo.isFirst = xxx;
        getStationResume(this.queryParamsAuitvo).then(response => {
          this.auitvoList = response.rows;
        });
      },
      downloadAll() {
        this.$download.zip(this.resIds)
      },
      getIds(val) {
        this.resIds = val.map(item => item.resumeId);
      },
      download(resumeId) {
        this.$download.zip(resumeId)
      },
      getAllocationResume(row) {
        this.getResumeUserList()
        getNamesByStationUserId(row.userId).then(res => {
          if (res.data.length > 0) {
            this.names = res.data
          }
        })
        this.stationUserId = row.userId
        this.resumeUserVisible = true
      },
      handleClick(tab, event) {
        this.resumeReset();
        this.stationReset()
      },
      checkAbutting(row) {
        checkAbutting(row.userId).then(res => {
          this.checkResumeList = res.data
          this.checkResumeVisible = true
        })
      },
      deleteCheckResume(row) {
        this.$confirm('是否确认解除与该招聘人员的对接?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          deleteCheckResume(row.resStaId).then(res => {
            checkAbutting(res.data.stationUserId).then(res => {
              this.getStationUserList()
              this.checkResumeList = res.data
              this.checkResumeVisible = true
            })
            this.$message({
              type: 'success',
              message: '已解除与' + row.nickName + '的关联!'
            });
          })
        })

      }
    }
  }
</script>

<style scoped>
  /deep/ .el-tabs__item {
    font-size: 20px;
  }
</style>
